package idGen;

import java.util.concurrent.atomic.AtomicInteger;

public class ServerIntIdGenerator implements IntIdGenerator {

	protected int serverId;
	protected AtomicInteger id = new AtomicInteger(0);
	
	public ServerIntIdGenerator(int serverId){
		this.serverId = serverId;
	}
	
	public int getServerId(){
		return this.serverId;
	}
	
	@Override
	public int next() {
		return (serverId<<25) | id.incrementAndGet();
	}

}
